package com.saq691.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 
 * 
 *
 * @datetime: 2022年11月18日 下午20:12:34
 * @author: sunaiqiang saq691@126.com
 * @version: 1.0
 */
@RestController
public class RedisController {
	private static final Logger logger = LoggerFactory.getLogger(RedisController.class);
	@Autowired
	private StringRedisTemplate stringRedisTemplate;

	/**
	 * 
	 * @return
	 */
	@GetMapping("/cluster")
	public String redisCluster() {
		String result = HttpStatus.OK.getReasonPhrase();
		stringRedisTemplate.opsForValue().set("saq", "saiqiang");
		String key = stringRedisTemplate.opsForValue().get("saq");
		logger.info(key);
		return result;
	}

}
